<?

class FileSystem {

    private function __construct() {
    }

    public static function getFilesByExtension ($dir, $ext, $fullNames = true) {
        $files = array();
		$h = @opendir($dir);
		while ($file = @readdir($h)) {
			if (preg_match("/(\.{$ext})$/i", $file)) {
    			$files[] = (($fullNames)?$dir:"").$file;
            }
        }
		return $files;
	}
    
}